/*
 * ECU_CAN.c
 *
 *  Created on: 2015-1-16
 *      Author: Hongjie Ma
 */
#include "BSW_Include.h"


/*************************配置CAN消息********************************/
//CAN_HandleType CAN_Nod0;
//CAN_HandleType CAN_Nod1;

//根据标定区域的情况配置各个CAN NOD的波特率

const CAN_Nodestr CAN_Node	=
{
	_250kbps,				//Baud rate of Nod 0
	_500kbps,				//Baud rate of Nod 1
	Yes,					//配置通道0终端电阻
	Yes						//配置通道1终端电阻
};

void ConfigGeneralNOD(void)
{
//	CAN_Nod0.BaudRate.BaudRatePresc = CAN002_Handle0.BaudRate.BaudRatePresc;
//	CAN_Nod0.BaudRate.DIV8 = CAN002_Handle0.BaudRate.DIV8;
//	CAN_Nod0.BaudRate.SyncJumpWidth = CAN002_Handle0.BaudRate.SyncJumpWidth;
//	CAN_Nod0.BaudRate.TimeSEG1 = CAN002_Handle0.BaudRate.TimeSEG1;
//	CAN_Nod0.BaudRate.TimeSEG2 = CAN002_Handle0.BaudRate.TimeSEG2;
//	CAN_Nod0.CanNodeRegs = CAN002_Handle0.CanNodeRegs;
//	CAN_Nod0.DynamicData = CAN002_Handle0.DynamicData;
//	CAN_Nod0.FirstMOMapping = CAN002_Handle0.FirstMOMapping;
//	CAN_Nod0.LoopBackModeEn= CAN002_Handle0.LoopBackModeEn;
//	CAN_Nod0.NodeID = CAN002_Handle0.NodeID;
//	CAN_Nod0.NodeMONo= CAN002_Handle0.NodeMONo;
//
//	CAN_Nod1.BaudRate.BaudRatePresc = CAN002_Handle1.BaudRate.BaudRatePresc;
//	CAN_Nod1.BaudRate.DIV8 = CAN002_Handle1.BaudRate.DIV8;
//	CAN_Nod1.BaudRate.SyncJumpWidth = CAN002_Handle1.BaudRate.SyncJumpWidth;
//	CAN_Nod1.BaudRate.TimeSEG1 = CAN002_Handle1.BaudRate.TimeSEG1;
//	CAN_Nod1.BaudRate.TimeSEG2 = CAN002_Handle1.BaudRate.TimeSEG2;
//	CAN_Nod1.CanNodeRegs = CAN002_Handle1.CanNodeRegs;
//	CAN_Nod1.DynamicData = CAN002_Handle1.DynamicData;
//	CAN_Nod1.FirstMOMapping = CAN002_Handle1.FirstMOMapping;
//	CAN_Nod1.LoopBackModeEn= CAN002_Handle1.LoopBackModeEn;
//	CAN_Nod1.NodeID = CAN002_Handle1.NodeID;
//	CAN_Nod1.NodeMONo= CAN002_Handle1.NodeMONo;
//
//// 配置波特率
//	switch(CAN_Node.BR0)
//	{
//		case _250kbps:
//			CAN_Nod0.BaudRate.BaudRatePresc = 0x2f;
//			break;
//		case _500kbps:
//			CAN_Nod0.BaudRate.BaudRatePresc = 0x17;
//			break;
//		case _1000kbps:
//			CAN_Nod0.BaudRate.BaudRatePresc = 0x0B;
//			break;
//	}
//	switch(CAN_Node.BR1)
//	{
//		case _250kbps:
//			CAN_Nod1.BaudRate.BaudRatePresc = 0x2f;
//			break;
//		case _500kbps:
//			CAN_Nod1.BaudRate.BaudRatePresc = 0x17;
//			break;
//		case _1000kbps:
//			CAN_Nod1.BaudRate.BaudRatePresc = 0x0B;
//			break;
//	}
//配置终端电阻
	switch(CAN_Node.TR0)
	{
		case Yes:
			Enable_CAN_TR0;
			break;
		case No:
			Disable_CAN_TR0;
			break;
	}
	switch(CAN_Node.TR1)
	{
		case Yes:
			Enable_CAN_TR1;
			break;
		case No:
			Disable_CAN_TR1;
			break;
	}
}


void ConfigGeneralMessageObject(void)
{

}



void TIU_CAN_Init(void)
{


}

